<template>
  <div id="app">
    <!--<router-view/>-->
    <!--头部信息-->
    <app-header :poiInfo="poiInfo"></app-header>

    <!--导航-->

    <Nav :commentNum="commentNum"></Nav>


    <!--内容-->
    <router-view/>
  </div>
</template>

<script>
import  Nav from './components/nav/nav'
import  Header from './components/header/Header'

export default {
  name: 'App',
  components:{
   "app-header":Header,
    Nav
  },
  data(){
    return{
      poiInfo:{},
      commentNum:0
    }
  },
  created(){
    fetch("/api/goods")
      .then(res=>{
        return res.json()
      })
      .then(response=>{
        // console.log(response)
        if ( response .code == 0){
          this.poiInfo=response.data.poi_info

        }
      })
    //请求ratings
    fetch("/api/ratings")
      .then(res=>{
        return res.json()
      })
      .then(response=>{
        // console.log(response)
        if ( response .code == 0){
          this.commentNum=response.data.comment_num

        }
      })

  }

}
</script>

<style >
  @import url(./common/css/icon.css);

</style>
